package org.action;

import java.util.Map;

import org.dao.DIDao;
import org.model.Dlb;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class LoginOutAction extends ActionSupport {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private DIDao dlDaoout;
	private Dlb loginJsp_dlb;
	private Dlb mainJsp_user;
	
	public Dlb getLoginJsp_dlb() {
		return loginJsp_dlb;
	}

	public void setLoginJsp_dlb(Dlb loginJsp_dlb) {
		this.loginJsp_dlb = loginJsp_dlb;
	}

	public Dlb getMainJsp_user() {
		return mainJsp_user;
	}

	public void setMainJsp_user(Dlb mainJsp_user) {
		this.mainJsp_user = mainJsp_user;
	}

	public DIDao getDlDaoout() {
		return dlDaoout;
	}

	public void setDlDaoout(DIDao dlDaoout) {
		this.dlDaoout = dlDaoout;
	}

	public String logout(){
		/*Dlb user = dlDao.validate(loginJsp_dlb.getXh(), loginJsp_dlb.getKl());
		if(user!=null){
			mainJsp_user = user;
			Map session = ActionContext.getContext().getSession();
			session.put("dlUser", user);
			return "success";
		}else
			return "error";*/
		Dlb user = dlDaoout.validate(loginJsp_dlb.getXh(),loginJsp_dlb.getKl());
		mainJsp_user = user;
		Map session = ActionContext.getContext().getSession();
		session.remove(session);
		
		return "success";
	}
}
